<template>
  <div>
    <h1>vue-xlsx-table</h1>
    <vue-xlsx-table @on-select-file="handleSelectedFile">上传xlsx文件转json</vue-xlsx-table>
    <!--导出用户信息excel表格-->
    <download-excel
      class="export-excel-wrapper"
      :data="json_data"
      :fields="json_fields"
      name="用户信息列表.xls"
    >
      <el-button type="primary" size="small">导出EXCEL</el-button>
    </download-excel>
  </div>
</template>

<script>
export default {
  data() {
    return {
      //导出excel
      json_fields: {
        姓名: "name", //常规字段
        用户名: "username",
        所属组织: "organization",
        权限: "auth"
      },
      json_data: [

        {
          name: "杰米",
          username: "admin2",
          organization: "地球村",
          auth: "超级管理员"
        }
      ],
      json_meta: [
        [
          {
            " key ": " charset ",
            " value ": " utf- 8 "
          }
        ]
      ]
    };
  },
  created() {},
  mounted() {},
  methods: {
    handleSelectedFile(convertedData) {
      console.log(convertedData);
    }
  }
};
</script>

<style scoped >
</style>
